|
- export default eventHandler(async (req) => {
- const [terms, page] = req.context.params?.termspage.split('-') || ''
- const url = `https://api.themoviedb.org/3/search/movie?query=${terms}&page=${page}&include_adult=false&language=en-US&page=1`
-
- const response = await fetch(url, {
- method: 'get',
- headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiI2MmVmZmYzYWU2YWYyNWQ0NTY4OGY3OTkxYjgyNmNhOCIsIm5iZiI6MTcyODA1NTIwMy4wNzcyNywic3ViIjoiNjcwMDA2ZjQ5ZWJlYTE5MDA2ZjgxZmJhIiwic2NvcGVzIjpbImFwaV9yZWFkIl0sInZlcnNpb24iOjF9.XuH-_0UggmULCgQQajKc-QsmlRYW2rqSenyhguE6wRU' }
- })
- const data = await response.json()
- return data.results
- })
|